﻿<%@ Page Title="" Language="C#" MasterPageFile="~/template/Admin.Master" AutoEventWireup="true"
    CodeBehind="Register.aspx.cs" Inherits="EmptyWallGallery.FrontEnd.inside.Manage.Register" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function ValidateChkList(source, arguments) {
            arguments.IsValid = IsCheckBoxChecked() ? true : false;
        }

        function IsCheckBoxChecked() {
            var isChecked = false;
            var list = document.getElementById('<%= cboList.ClientID %>');
            if (list != null) {
                for (var i = 0; i < list.rows.length; i++) {
                    for (var j = 0; j < list.rows[i].cells.length; j++) {
                        var listControl = list.rows[i].cells[j].childNodes[0];
                        if (listControl.checked) {
                            isChecked = true;
                        }
                    }
                }
            }
            return isChecked;
        }
    </script>
    <style type="text/css">
        .form-field label { float: left; }
    </style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ctphTitle" runat="server">
    <h1>Tạo mới tài khoản</h1>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctphMain" runat="server">
    <asp:Literal ID="ErrorMessage" runat="server"></asp:Literal>
    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
        CssClass="alert alert-error" ErrorMessage="* Nhập tên đăng nhập." ToolTip="* Nhập tên đăng nhập."
        ValidationGroup="RegisterUserValidationGroup" Display="Dynamic">* Nhập tên đăng nhập</asp:RequiredFieldValidator>
    <asp:RequiredFieldValidator ID="EmailRequired" runat="server" ControlToValidate="Email"
        CssClass="alert alert-error" ErrorMessage="* Nhập Email." ToolTip="* Nhập Email."
        ValidationGroup="RegisterUserValidationGroup" Display="Dynamic">* Nhập Email.</asp:RequiredFieldValidator>
    <asp:CustomValidator ID="CustomValidator1" ClientValidationFunction="ValidateChkList"
        runat="server" CssClass="alert alert-error" ValidationGroup="RegisterUserValidationGroup" 
        ErrorMessage="* Nhập quyền hạn" Display="Dynamic"></asp:CustomValidator>

    <asp:ValidationSummary ID="RegisterUserValidationSummary" runat="server" CssClass="alert alert-error"
        ValidationGroup="RegisterUserValidationGroup" EnableClientScript="true" ShowMessageBox="False"
        ShowSummary="false" />
    
    <asp:Label ID="lblMessage" CssClass="alert alert-error" runat="server" Text=""></asp:Label>

    <div class="form-wrap">
        <div class="form-field">
            <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">Tên đăng nhập:</asp:Label>
            <asp:TextBox ID="UserName" runat="server" CssClass="textEntry" Width="210px"></asp:TextBox>
        </div>
        <div class="form-field">
            <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">E-mail:</asp:Label>
            <asp:TextBox ID="Email" runat="server" CssClass="textEntry" Width="210px"></asp:TextBox>
        </div>
        <div class="form-field">
            <asp:Label ID="Label1" runat="server">Quyền hạn:</asp:Label>
            <asp:CheckBoxList ID="cboList" runat="server" CssClass="tblRoles">
            </asp:CheckBoxList>
        </div>
        <div class="clearfix"></div>
        <div class="form-field">
            <p class="submitButton">
                <asp:Button ID="BtnCreateUser" CssClass="btn btn-primary" runat="server" Text="Tạo mới" OnClick="BtnCreateUserClick"
                    ValidationGroup="RegisterUserValidationGroup" />
            </p>
        </div>
    </div>
</asp:Content>
